import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import AutoImport from 'unplugin-auto-import/vite'
import Components from "unplugin-vue-components/vite"; //自动导入插件
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
import Icons from "unplugin-icons/vite"; //自动引入图标

export default defineConfig({
  plugins: [
    vue(),
  
    // 配置unplugin-vue-components以按需引入ElementPlus组件
    Components({
      resolvers: [ElementPlusResolver()],
    }),
    AutoImport({
      imports: ['vue', 'vue-router'],
      resolvers: [ElementPlusResolver()],
      dirs: ['src/utils/**'],
    }),
    // 配置unplugin-icons以按需引入ElementPlus Icons
    Icons({
      compiler: 'vue3',
      autoInstall: true,
      defaultStyle: 'vertical-align: middle;',
      customCollections: {
        'element-plus': () => import('@element-plus/icons-vue'),
      },
    }),
  ],
});

